-
-
Notifications
You must be signed in to change notification settings - Fork 387
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rework button code #9525
Open
zenseii
wants to merge
55
commits into
ihhub:master
Choose a base branch
from
zenseii:rework-button-code
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Rework button code #9525
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
zenseii
added
improvement
New feature, request or improvement
ui
UI/GUI related stuff
translation
Things related to languages and translations
labels
Feb 3, 2025
because we can resize into any size now
It uses a worse version of the English one that we generate.
It uses just a worse font than the English one we generate.
battle only buttons.
Can't be removed until button texts can be crammed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clang-Tidy
found issue(s) with the introduced code (1/1)
Fix French Min button transparency
Fix all French and Polish variants of min and max buttons
now that offset post crop is fixed
Rename buy max and gift button names
Fix high scores vertical buttons
Branikolog
approved these changes
Feb 7, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
bug
Something doesn't work
improvement
New feature, request or improvement
translation
Things related to languages and translations
ui
UI/GUI related stuff
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adjusting to this change meant addressing a lot of long standing UI visual bugs.
What this PR does:
Allows to generate buttons with fixed height and width. This is necessary for Add return to main menu and play map buttons to the editor #9512.
Allows to choose button background for fixed size generated buttons.
Added palette conversion table for good buttons to evil buttons. This makes it easier than trying to make evil style buttons by hand for those button types that don't have that originally, and it fixed the wrong pressed state for map select button. This will also help to add evil style buttons for the editor.
Improved button shine effect. Still not added for vertical buttons. It varies according to size of the button. Related to Expanding the button shine logic #9477
Switched to
createNormalButton()
in all but 1 set of buttons (vertical high scores buttons) inagg_image.cpp
.Renamed
getTextAdaptedButton()
togetTextAdaptedSprite()
Added black background so that we can use the smaller buttons near the well's status bar other places like in editor dialogs instead of the small buttons there.
Added brown background to fix see through in the kingdom overview screen. Also fixed some wrong button placement in this dialog. Part of Kingdom Overview screen, Heroes Overview and Towns/Castles Overview screens, change the frame color and adjust the position of the buttons #1843 and Kingdom Overview screen, Heroes Overview and Towns/Castles Overview screens, wrong position of elements #1842
Added code to generate buttons that are shorter than 96px yet taller than 25px (needed for various dialogs like view world).
Fix French min/max buttons transparency issues with M letter
Generate French and Polish MIN and MAX buttons from their original assets.
Remove all Italian specific button generations. The font used there is just a worse version of the one we generate.
Removed Medium size empty button now that we can resize in height.
Also a lot of button code tidying.
Other button info:
Text buttons that the engine needs to be able to make are these three:
getCustomNormalButton()
which is called bymakeButtonSprites()
inui_button.cpp
andcreateNormalButton()
inagg_image.cpp
. The only difference is thatmakeButtonSprites()
doesn't translate text. Perhaps they could be combined.getTextAdaptedSprite()
inui_button.cpp
.ui_button.cpp
.Then there's a couple of calls to make/render buttons from various methods of
fheroes2::StandardWindow
. Ideally there should be a way to generate a window which adjusts its size according to the size of the buttons, to avoid any translations going outside of the window border.